package com.woniu.cms.finance.core.controller;


import com.woniu.cms.finance.core.entity.FinanceInvoiceIncome;
import com.woniu.cms.finance.core.service.IFinanceAccountingService;
import com.woniu.cms.finance.core.service.IFinanceInvoiceIncomeService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 开票审批表 前端控制器
 * </p>
 *
 * @author kiron
 * @since 2022-09-19
 */
@RestController
@RequestMapping("/finance-invoice-income")
@Api(tags = "开票审批")
public class FinanceInvoiceIncomeController {
    @Autowired
    private IFinanceInvoiceIncomeService iFinanceInvoiceIncomeService;

    @Autowired
    private IFinanceAccountingService iFinanceAccountingService;

    @GetMapping("list")
    @ApiOperation("查询历史开票")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "projectNum",value = "项目编号")
    })

    public Result getList(String projectNum){
        Result list = iFinanceInvoiceIncomeService.getList(projectNum);
        return list;
    }
    @PostMapping("insert")
    @ApiOperation("添加开票审批表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "financeInvoiceIncome",value = "添加开票审批对象")
    })
    public Result addInvoice(@RequestBody FinanceInvoiceIncome financeInvoiceIncome){
        Result save = iFinanceInvoiceIncomeService.saveInvoice(financeInvoiceIncome);
        return save;
    }

    @PutMapping("update")
    @ApiOperation("修改开票审批申请")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "financeInvoiceIncome",value = "修改的对象")
    })
    public Result updateInvoice(@RequestBody FinanceInvoiceIncome financeInvoiceIncome){
       Result result = iFinanceInvoiceIncomeService.updateInvoice(financeInvoiceIncome);
       return result;
    }

    @GetMapping("all")
    @ApiOperation("所有开票审批查询")
    public Result getAll(Integer currentPage, Integer pageSize){
        Result result = iFinanceInvoiceIncomeService.getAll(currentPage,pageSize);
        return result;
    }



}

